Skip to content

feat: add Novita AI as LLM provider#1339

Open
Alex-wuhu wants to merge 13 commits intoMemTensor:openclaw-local-plugin-20260324from
Alex-wuhu:novita-integration
Open

feat: add Novita AI as LLM provider#1339
Alex-wuhu wants to merge 13 commits intoMemTensor:openclaw-local-plugin-20260324from
Alex-wuhu:novita-integration

Conversation

@Alex-wuhu
Copy link

Summary

Add Novita AI as a new LLM provider. Novita offers an OpenAI-compatible API with competitive pricing and a wide selection of open-source models.

Changes

  • New Novita provider following existing provider patterns
  • API key configuration via NOVITA_API_KEY environment variable
  • Support for chat, completion, and embedding models

Configuration

NOVITA_API_KEY=your_key_here

Endpoint: https://api.novita.ai/openai

hijzy and others added 13 commits March 19, 2026 16:32
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes @issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes @issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes #issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
### ## Description

Please include a summary of the change, the problem it solves, the
implementation approach, and relevant context. List any dependencies
required for this change.

Related Issue (Required):  Fixes #issue_number

## Type of change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (does not change functionality, e.g. code style
improvements, linting)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration

- [ ] Unit Test
- [ ] Test Script Or Test Steps (please provide)
- [ ] Pipeline Automated API Test (please provide)

## Checklist

- [ ] I have performed a self-review of my own code | 我已自行检查了自己的代码
- [ ] I have commented my code in hard-to-understand areas |
我已在难以理解的地方对代码进行了注释
- [ ] I have added tests that prove my fix is effective or that my
feature works | 我已添加测试以证明我的修复有效或功能正常
- [ ] I have created related documentation issue/PR in
[MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) (if applicable) |
我已在 [MemOS-Docs](https://github.com/MemTensor/MemOS-Docs) 中创建了相关的文档
issue/PR(如果适用)
- [ ] I have linked the issue to this PR (if applicable) | 我已将 issue
链接到此 PR(如果适用)
- [ ] I have mentioned the person who will review this PR | 我已提及将审查此 PR
的人

## Reviewer Checklist
- [ ] closes #xxxx (Replace xxxx with the GitHub issue number)
- [ ] Made sure Checks passed
- [ ] Tests have been provided
Add NovitaLLMConfig class extending OpenAILLMConfig with default
api_base pointing to Novita's OpenAI-compatible endpoint.

Register 'novita' backend in LLMConfigFactory for Python backend.

Add 'novita' to SummaryProvider and EmbeddingProvider types in
TypeScript plugin, with routing to OpenAI-compatible API handlers.
@hijzy hijzy changed the base branch from main to openclaw-local-plugin-20260324 March 24, 2026 11:50
@hijzy
Copy link
Collaborator

hijzy commented Mar 24, 2026

PR Review

This PR adds Novita AI as a new embedding provider by routing it through the existing OpenAI-compatible endpoint. The addition itself is minimal and follows the established pattern for providers like zhipu, siliconflow, and bailian — it simply adds "novita" as a new case in the embedding switch statement.

However, it also includes larger changes to index.ts and postinstall.cjs that improve native module loading robustness (ESM createRequire, isPathInside security check via realpathSync, shell: false for spawn calls, Windows npm.cmd support, path normalization for \\?\\ prefixes). These improvements are solid.

Notable issue: There is a duplicated const startMs and const result block in postinstall.cjs for the better-sqlite3 rebuild that will cause a runtime error. This duplicate appears right after the new npmCmd-based rebuild call, creating conflicting variable declarations.

此 PR 将 Novita AI 添加为新的嵌入提供者,改动很小且遵循已有的 provider 模式。但还包含了 index.tspostinstall.cjs 的原生模块加载改进。值得注意的是,postinstall.cjsbetter-sqlite3 rebuild 代码块被重复声明了两次(const startMsconst result),会导致运行时报错。

  • Safety: ⚠️ Duplicate code bug in postinstall
  • Mergeable: After fixing the duplicate
  • Confidence: 3/5

@hijzy
Copy link
Collaborator

hijzy commented Mar 24, 2026

🔧 Suggested Fix

Remove the duplicate better-sqlite3 rebuild block in postinstall.cjs. Around line 392, the old const startMs = Date.now(); and const result = spawnSync("npm", ...) still exist alongside the new npmCmd-based version added just above. Delete the old block (lines starting from the second const startMs through the closing of the old spawnSync call) to resolve the conflicting variable declarations.

🔧 修改建议

删除 postinstall.cjs 中重复的 better-sqlite3 rebuild 代码块。在第 392 行附近,旧的 const startMs = Date.now();const result = spawnSync("npm", ...) 仍然存在于新添加的 npmCmd 版本之后。删除旧代码块(从第二个 const startMs 开始到旧的 spawnSync 调用结束)即可解决变量声明冲突。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants